basedir := ../..
antlr  := antlr
srcdir := .
pathhere := parse/test
objdir := $(basedir)/obj/$(pathhere)

parsedir := parse



CXX = ccache g++
COMPILEFLAGS = -Wall -I/usr/local/include -I$(basedir)/$(parsedir)
LINKFLAGS = -L/usr/local/lib -L$(basedir)/obj/$(parsedir)  -lcppunit -ldl -lantlr

objnameshere := TestMain.o
objnamesparse := PlantainParser.o PlantainLexer.o

objfileshere := $(addprefix $(objdir)/, $(objnameshere))
objfilesparse := $(addprefix $(basedir)/obj/$(parsedir)/, $(objnamesparse))

executables := lextest

all: lextest

test: TestMain.o
	$(CXX) $(LINKFLAGS) $(objfileshere) $(objfilesparse) -o $(objdir)/test

%.o: %.cpp
	$(CXX) -c $< -o $(objdir)/$@ $(COMPILEFLAGS)

check: test
	echo "Running tests..."
	$(objdir)/test

clean: 
	-rm $(objdir)/*